package kadledav.adventure.framework.model.world.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import kadledav.adventure.framework.model.general.impl.DescribableBasicObject;
import kadledav.adventure.framework.model.world.Item;
import kadledav.adventure.framework.model.world.Location;
import kadledav.adventure.framework.model.world.Passage;

public class LocationBasic extends DescribableBasicObject implements Location {

	private List<Item> items = new ArrayList<Item>();
	private List<Passage> possibleExits = new ArrayList<Passage>();
	
	public LocationBasic(String name, String description) {
		super(name, description);
	}

	public List<Item> getItems() {
		return Collections.unmodifiableList(items);
	}

	public List<Passage> getPossibleExits() {
		return Collections.unmodifiableList(possibleExits);
	}

	public boolean addItem(Item item){
		return items.add(item);
	}
	
	public void setPossibleExits(List<Passage> possibleExits) {
		this.possibleExits = possibleExits;
	}
	
	public boolean addPassage(Passage passage){
		return possibleExits.add(passage);
	}

	@Override
	public boolean playerTookItem(Item item) {
		if (item.isTakeable()){			
			return items.remove(item);
		}
		return false;
	}

	@Override
	public boolean playerDropItem(Item item) {
		return items.add(item);
	}

}
